<template>
  <div>
    <MyHeader
      title="购物车案例"
      backgroundColor="skyblue"
      color="write"
    ></MyHeader>
    <div class="main">
      <MyGoods v-for="obj in goodsList" :key="obj.id" :goodsObj="obj"></MyGoods>
    </div>
    <MyFooter :arr="goodsList"></MyFooter>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader";
import MyGoods from "./components/MyGoods";
import MyFooter from "./components/MyFooter";

import { mapActions, mapState } from "vuex";
export default {
  components: {
    MyHeader,
    MyGoods,
    MyFooter,
  },
  data() {
    return {
      list: [],
    };
  },
  computed: {
    ...mapState({
      goodsList: (state) => state.shopcarmodule.goodsList,
    }),
  },
  methods: {
    ...mapActions("shopcarmodule", ["asyncgoodList"]),
  },
  created() {
    this.asyncgoodList();
  },
};
</script>

<style scoped>
.main {
  padding: 45px 0 50px 0;
}
</style>